﻿using SyncFileCommon.Class;
using SyncFileCommon.Model;

namespace SyncFileCommon.BLL
{
    public class SyncDirectoryBLL
    {

        public static List<SyncDirectoryModel> DirectoryList = null;

        /// <summary>
        /// 获取共享文件夹列表
        /// </summary>
        /// <returns></returns>
        public static List<SyncDirectoryModel> DirectoryListGet()
        {
            List<SyncDirectoryModel> _directoryList = JsonHelper.GetObjectFromJsonStr<List<SyncDirectoryModel>>(FileHelper.FileTextRead(FileHelper.GetRunPath() + "SyncDirectory"));
            DirectoryList = _directoryList;
            return _directoryList;
        }

        /// <summary>
        /// 保存共享文件夹列表
        /// </summary>
        /// <param name="userList"></param>
        public static void DirectoryListSave(List<SyncDirectoryModel> directoryList)
        {
            DirectoryList = directoryList;
            FileHelper.FileTextWrite(FileHelper.GetRunPath() + "SyncDirectory", JsonHelper.GetJsonStrFromObject(directoryList));
        }
    }
}
